@model IEnumerable<UI.Models.GameDisplay>

@{
    ViewBag.Title = "Index";
}

<h2>Index</h2>

<p>
    @Html.ActionLink("Create New", "Create")
</p>
<table>
    <tr>
        <th></th>
        <th>
            Id
        </th>
        <th>
            Game Date
        </th>
        <th>
            Game Time
        </th>
        <th>
            Status
        </th>
        <th>
            Currently Playing
        </th>
        <th>
            Currently Substituting
        </th>
        
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            @*@Html.ActionLink("Details", "Details", new { id=item.GameId })*@

            @Html.ActionLink("Add Player", "AddPlayer", new { id = item.GameId })
        </td>
        <td>
			@Html.DisplayTextFor(_ => item.GameId)
        </td>
        <td>
			@String.Format("{0:d}", item.GameDate)
        </td>
        <td>
			@Html.DisplayTextFor(_ => item.GameTime)
        </td>
        <td>
			@Html.DisplayTextFor(_ => item.GameStatus)
        </td>
        <td>
			@(item.Playing == null ? "None" : item.Playing.Count.ToString())
        </td>
        <td>
			@(item.Playing == null ? "None" : item.Substitutions.Count.ToString())
        </td>
    </tr>
}

</table>


